package com.example.modulethree.activity

import android.app.LocalActivityManager
import android.os.Bundle
import com.example.modulethree.delegate.KotlinTabHostTestActivityDelegate
import com.example.mvp.activity.BaseMVPActivity
import com.example.mvp.binder.BaseDataBinder

/**
 * Created by sun.li on 2018/7/3.
 * @author sun.li
 */
class KotlinTabHostTestActivity : BaseMVPActivity<KotlinTabHostTestActivityDelegate>(){

    override fun initDate() {
    }

    override fun bindEvenListener() {
    }

    override fun getDelegateClass(): Class<KotlinTabHostTestActivityDelegate> {
        return KotlinTabHostTestActivityDelegate::class.java
    }

    override fun getDataBinder(): BaseDataBinder<*, *>? {
        return null
    }

    override fun initView(p0: Bundle?) {
        //初始化activity管理者
        val manager = LocalActivityManager(this, false)
        //通过管理者保存当前页面状态
        manager.dispatchCreate(p0)
        viewDelegate.initTabHost(manager)
    }

    override fun onDestroy() {
        //此处调用为了解决TabHost使用过程中的内存泄漏问题，需要根据具体的情况处理内存泄漏问题
        viewDelegate.clearTabHost()
        super.onDestroy()

    }
}